package com.scheduling.system.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.scheduling.common.annotation.Log;
import com.scheduling.common.core.controller.BaseController;
import com.scheduling.common.core.domain.AjaxResult;
import com.scheduling.common.enums.BusinessType;
import com.scheduling.system.domain.Specialdatemanagement;
import com.scheduling.system.service.ISpecialdatemanagementService;
import com.scheduling.common.utils.poi.ExcelUtil;
import com.scheduling.common.core.page.TableDataInfo;

/**
 * 特殊日期管理Controller
 * 
 * 
 * @date 2025-05-07
 */
@RestController
@RequestMapping("/system/specialdatemanagement")
public class SpecialdatemanagementController extends BaseController
{
    @Autowired
    private ISpecialdatemanagementService specialdatemanagementService;

    /**
     * 查询特殊日期管理列表
     */
    @PreAuthorize("@ss.hasPermi('system:specialdatemanagement:list')")
    @GetMapping("/list")
    public TableDataInfo list(Specialdatemanagement specialdatemanagement)
    {
        startPage();
        List<Specialdatemanagement> list = specialdatemanagementService.selectSpecialdatemanagementList(specialdatemanagement);
        return getDataTable(list);
    }

    /**
     * 导出特殊日期管理列表
     */
    @PreAuthorize("@ss.hasPermi('system:specialdatemanagement:export')")
    @Log(title = "特殊日期管理", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, Specialdatemanagement specialdatemanagement)
    {
        List<Specialdatemanagement> list = specialdatemanagementService.selectSpecialdatemanagementList(specialdatemanagement);
        ExcelUtil<Specialdatemanagement> util = new ExcelUtil<Specialdatemanagement>(Specialdatemanagement.class);
        util.exportExcel(response, list, "特殊日期管理数据");
    }

    /**
     * 获取特殊日期管理详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:specialdatemanagement:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(specialdatemanagementService.selectSpecialdatemanagementById(id));
    }

    /**
     * 新增特殊日期管理
     */
    @PreAuthorize("@ss.hasPermi('system:specialdatemanagement:add')")
    @Log(title = "特殊日期管理", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody Specialdatemanagement specialdatemanagement)
    {
        return toAjax(specialdatemanagementService.insertSpecialdatemanagement(specialdatemanagement));
    }

    /**
     * 修改特殊日期管理
     */
    @PreAuthorize("@ss.hasPermi('system:specialdatemanagement:edit')")
    @Log(title = "特殊日期管理", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody Specialdatemanagement specialdatemanagement)
    {
        return toAjax(specialdatemanagementService.updateSpecialdatemanagement(specialdatemanagement));
    }

    /**
     * 删除特殊日期管理
     */
    @PreAuthorize("@ss.hasPermi('system:specialdatemanagement:remove')")
    @Log(title = "特殊日期管理", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(specialdatemanagementService.deleteSpecialdatemanagementByIds(ids));
    }
}
